package com.hee.erp.modules.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.hee.erp.common.R;
import com.hee.erp.modules.entity.Car;
import com.hee.erp.modules.entity.SysSalary;
import com.hee.erp.modules.service.ISysSalaryService;
import com.hee.erp.vo.page.SalaryPageParams;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/modules/salary")
@Api(tags = "工资模块")
public class SalaryController {

    @Autowired
    ISysSalaryService service;

    @PostMapping("/listByPage")
    @ApiOperation(value = "listByPage")
    public R listByPage(@RequestBody SalaryPageParams params){
        IPage page = service.listByPage(params);
        return R.success(page);
    }

    @ApiOperation(value = "getById")
    @GetMapping("/getById")
    public R getById(String id){
        SysSalary entity = service.getDetailById(id);
        return R.success(entity);
    }

    @PostMapping("/save")
    @ApiOperation(value = "save")
    public R save(@RequestBody SysSalary entity){
        service.saveDetail(entity);
        return R.success(entity);
    }

    @ApiOperation("delById")
    @GetMapping("/delById")
    public R delById(String id){
        service.removeById(id);
        return R.success(true);
    }
}
